<!DOCTYPE html>
<!--[if IE 9]>         <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8">

    <title>数字币对冲平台|BDS虚拟币对冲平台</title>
 		<#include "../static/top.ftl" >

</head>
<body>
<!-- Page Wrapper -->
<!-- In the PHP version you can set the following options from inc/config file -->
<!--
    Available classes:

    'page-loading'      enables page preloader
-->
<div id="page-wrapper" class="page-loading">
    <!-- Preloader -->
    <!-- Preloader functionality (initialized in js/app.js) - pageLoading() -->
    <!-- Used only if page preloader enabled from inc/config (PHP version) or the class 'page-loading' is added in #page-wrapper element (HTML version) -->
    <div class="preloader">
        <div class="inner">
            <!-- Animation spinner for all modern browsers -->
            <div class="preloader-spinner themed-background hidden-lt-ie10"></div>

            <!-- Text for IE9 -->
            <h3 class="text-primary visible-lt-ie10"><strong>Loading..</strong></h3>
        </div>
    </div>

    <div id="page-container" class="header-fixed-top sidebar-visible-lg-full sidebar-light">
        <!-- Alternative Sidebar -->

        <!-- END Alternative Sidebar -->

        <!-- Main Sidebar -->



                <#include "../static/menu.ftl" >


        <!-- END Main Sidebar -->

        <!-- Main Container -->
        <div id="main-container">
            <!-- Header -->



                     <#include "../static/header.ftl" >
            <!-- END Header -->

            <!-- Page content -->
            <div id="page-content">
                <!-- Validation Header -->
                <div class="content-header">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="header-section">
                                <h1>API设置</h1>
                            </div>
                        </div>
                        <div class="col-sm-6 hidden-xs">
                            <div class="header-section">
                                <ul class="breadcrumb breadcrumb-top">
                                    <li>User Interface</li>
                                    <li>Forms</li>
                                    <li><a href="">Validation</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- END Validation Header -->

                <!-- Form Validation Content -->
                <div class="row">
                    <div>
                        <!-- Form Validation Block -->
                        <div class="block">
                            <!-- Form Validation Form -->
                            <form id="form-set-api" method="post" class="form-horizontal form-bordered">
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="val-skill">交易所</label>
                                    <div class="col-md-6">
                                        <select id="api_exchange" name="api_exchange" class="form-control">
                                            <option value="">请选择</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="access-key">AccessKey </label>
                                    <div class="col-md-6">
                                        <input type="text" id="access_key" name="access-key" class="form-control" placeholder="">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="secret-key">SecretKey </label>
                                    <div class="col-md-6">
                                        <input type="text" id="secret_key" name="secret-key" class="form-control" placeholder="">
                                    </div>
                                </div>
                                <div class="form-group form-actions">
                                    <div class="col-md-8 col-md-offset-3">
                                        <button id="submit_keys" type="button" class="btn btn-effect-ripple btn-primary">确定</button>
                                        <button type="reset" class="btn btn-effect-ripple btn-danger">取消</button>
                                    </div>
                                </div>
                            </form>
                            <!-- END Form Validation Form -->

                            <!-- Terms Modal -->
                            <div id="modal-terms" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h3 class="modal-title text-center"><strong>Terms and Conditions</strong></h3>
                                        </div>
                                        <div class="modal-body">
                                            <h4 class="page-header">1. <strong>General</strong></h4>
                                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ultrices, justo vel imperdiet gravida, urna ligula hendrerit nibh, ac cursus nibh sapien in purus. Mauris tincidunt tincidunt turpis in porta. Integer fermentum tincidunt auctor.</p>
                                            <h4 class="page-header">2. <strong>Account</strong></h4>
                                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ultrices, justo vel imperdiet gravida, urna ligula hendrerit nibh, ac cursus nibh sapien in purus. Mauris tincidunt tincidunt turpis in porta. Integer fermentum tincidunt auctor.</p>
                                            <h4 class="page-header">3. <strong>Service</strong></h4>
                                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ultrices, justo vel imperdiet gravida, urna ligula hendrerit nibh, ac cursus nibh sapien in purus. Mauris tincidunt tincidunt turpis in porta. Integer fermentum tincidunt auctor.</p>
                                            <h4 class="page-header">4. <strong>Payments</strong></h4>
                                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ultrices, justo vel imperdiet gravida, urna ligula hendrerit nibh, ac cursus nibh sapien in purus. Mauris tincidunt tincidunt turpis in porta. Integer fermentum tincidunt auctor.</p>
                                        </div>
                                        <div class="modal-footer">
                                            <div class="text-center">
                                                <button type="button" class="btn btn-effect-ripple btn-primary" data-dismiss="modal">I've read them!</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- END Terms Modal -->
                        </div>
                        <!-- END Form Validation Block -->
                    </div>
                </div>
                <!-- END Form Validation Content -->
            </div>
            <!-- END Page Container -->
        </div>
        <!-- END Page Wrapper -->


        <script>
            $(function () {
                initExchange();
            });


            function initExchange(){
                $.get("/exchange/list",function (data) {
                    var list=data.data;
                    var html="";
                    for (var i = 0; i <list.length; i++) {
                        html+="<option value="+list[i]+">"+list[i]+"</option>"
                    }
                    $("#api_exchange").append(html);
                });
            };

            $("#submit_keys").click(function () {

                        var api_exchange=$("#api_exchange").val();
                        var access_key=$("#access_key").val();
                        var secret_key=$("#secret_key").val();
                        if(access_key==""||secret_key=="") {
                            alert("请填写完整信息！")
                        }else{
                            var params={
                                api_exchange:api_exchange,
                                access_key:access_key,
                                secret_key:secret_key
                            };
                            $.post("/setup/keys/submit",params,function(data){
                                alert(data.msg);
                            });
                        }
                    }
            );

        </script>
</body>
</html>